package com.inmaytide.website.mapper.system;

import com.inmaytide.website.domain.entities.system.SysLog;
import com.inmaytide.website.mapper.system.provider.SysLogMapperSQLProvider;
import com.inmaytide.website.utils.pagination.Pagination;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface SysLogMapper extends Mapper<SysLog> {

    @SelectProvider(type = SysLogMapperSQLProvider.class, method = "findByMultipleConditionsAndPagination")
    @Results({
            @Result(column = "operating_time", property = "operatingTime"),
            @Result(column = "operator_ip", property = "operatorIp")
    })
    public List<SysLog> findListByMultipleConditionsAndPagination(@Param("pagination") Pagination<SysLog> pagination);

    @SelectProvider(type = SysLogMapperSQLProvider.class, method = "findListByMultipleConditions")
    @Results({
            @Result(column = "operating_time", property = "operatingTime"),
            @Result(column = "operator_ip", property = "operatorIp")
    })
    public List<SysLog> findListByMultipleConditions(@Param("conditions") Map<String, String> conditions);

    @SelectProvider(type = SysLogMapperSQLProvider.class, method = "findCountByMultipleConditions")
    public Integer findCountByMultipleConditions(@Param("pagination") Pagination<SysLog> pagination);

    @Delete({
            "TRUNCATE TABLE sys_log",
    })
    public Integer clear();
}